'use strict';
function shutdown() {
    var result = confirm("是否确认关机？");
    if (result) {
        alert("准备启动关机");
        $.get("/command/shutdown");
    }
};

function freshFile(index) {
    var currentPath = $("#storeValue").attr("currentpath");
    console.log("freshFile %d", index);
    console.log("currentPath %s", "/getDirPath/fresh?path=" + currentPath + "&page=" + index);
    $.post(
        "/getDirPath/fresh",
        {"path" : currentPath, "page":index},
        function(data){
            console.log(data);
            $("#fileContent").empty();
            data.forEach(function(element) {
                console.log(element);
                $("#fileContent").append("<p><label>" + element.timeFormat + "</label>&nbsp;&nbsp;&nbsp;<a href=\"/file/open/" + element.type + "?dir=" + element.dir + "\">" + element.name + "</a></p>");
            });
            var oldPage = parseInt($("#storeValue").attr("currentpage"));
            $("#idx_" + oldPage).css("color","black");
            $("#idx_" + index).css("color","red");
            $("#storeValue").attr("currentpage", ""+index);
        },
      );
};

function load() {
    $("#idx_1").css("color","red");
}